package com.leyou.item.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leyou.item.dto.SkuDTO;
import com.leyou.item.entity.Sku;
import com.leyou.item.mapper.SkuMapper;
import com.leyou.item.service.SkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;


@Service
public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuService {
    @Autowired
    SkuMapper skuMapper;
    @Override
    public List<SkuDTO> querySkuListByIds(List<Long> ids) {
        return SkuDTO.convertEntityList(this.listByIds(ids));
    }

    @Override
    public List<SkuDTO> querySkuListBySpuId(Long spuId) {
        List<Sku> skuList = this.query().eq("spu_id", spuId).list();
        skuList.forEach(System.out::println);
        return SkuDTO.convertEntityList(skuList);
    }
}
